# coding=utf-8
import sys
reload(sys)

sys.setdefaultencoding('utf-8')

import wxpy

if 'FileNotFoundError' not in globals():
    print('PATCH')
    FileNotFoundError = IOError

bot = wxpy.Bot()

# friend = wxpy.ensure_one(bot.friends().search(u'哈哈爱护的吧'))
# friend.send('hello, world')

group = wxpy.ensure_one(bot.groups().search(u'测试群聊'))


@bot.register(group, wxpy.TEXT)
def handle_group_message(msg):
    print msg.sender, '|', msg.receiver, '|', msg.member
    print msg.member.name, msg.member.nick_name, msg.member.display_name
    group.send(u'确认消息：{}'.format(msg.text))


bot.join()
